 lapack_int LAPACKE_dgeev( int matrix_order, char jobvl, char jobvr,
lapack_int n, double * a, lapack_int lda, double * wr,
double * wi, double * vl, lapack_int ldvl, double * vr,
lapack_int ldvr );

#include <stdio.h>

// lapacke headers
#include " lapacke.h "
#include " lapacke_config.h "
#include " lapacke_utils.h "

extern lapack_int LAPACKE_dgeev( int matrix_order, char jobvl, char jobvr,
lapack_int n, double * a, lapack_int lda, double * wr,
double * wi, double * vl, lapack_int ldvl, double * vr,
lapack_int ldvr );

int main(){
int matrix_order = LAPACK_COL_MAJOR;
char jobvl = ' N ' ;
char jobvr = ' V ' ;
int n = 50 ;
double A[50][50] = {};
ifstream infile("A.csv");
 while(getline(infile, line)){

 istringstream Istrstream(line);
 int p;int q;double z;
 char s1;
 char s2;
 Istrstream >> p >> s1>> q >> s2 >> z;
if(max<p){
 max=p;
 }

 A[p-1][q-1]=z;
 }
 infile.close();
int lda = n;
double wr[ 50 ] = {};
double wi[ 50] = { };
double vl[ 250 ];
int ldvl = 50 ;
double vr[ 250 ];
int ldvr = 50 ;

int info = LAPACKE_dgeev(matrix_order,jobvl,jobvr,n,A,lda,wr,wi,vl,ldvl,vr,ldvr);
if (info == 0 ){
int i = 0 ;
int j = 0 ;
for (i = 0 ;i < n;i ++ ){
printf( " eigenvalue %d:\n " ,i);
printf( " %.6g + i %.6g \t " ,wr[i],wi[i]);
printf( " right eigenvector: " );
for (j = 0 ;j < ldvr;j ++ )
printf( " %.6g \t " ,vr[i * 4 + j]);
printf( " \n " );
}
printf( " SUCCESS\n " );
}

return 0 ;
}
